UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PpnfD0Q+GKTi3qrulJVMxFmSk61I7k9rVV9hHxNZHSg='
WHERE
key_id = 'a99bb490e2a6196fdfd10b6739f24dd9df95f710fd0abecb7a799d62976b772a'
AND (
token = 'PpnfD0Q+GKTi3qrulJVMxFmSk61I7k9rVV9hHxNZHSg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)