UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YSYeqZSdGsY9M3IV2keB6iCiNNzUecW4PT3DB5pVX+s='
WHERE
key_id = 'adea3483f63e37210797f594ad2486a04ba60d04c0613ef6ba788fbab465364b'
AND (
token = 'YSYeqZSdGsY9M3IV2keB6iCiNNzUecW4PT3DB5pVX+s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)