UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aFyW/1HL7VcKk/+1xAdFyej0lz+XZxAQdfH35yCqVqI='
WHERE
key_id = '6770b89ed0da0d1863eecbf74a9fa1c83f304e32c2f42534812165b196ffb09b'
AND (
token = 'aFyW/1HL7VcKk/+1xAdFyej0lz+XZxAQdfH35yCqVqI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)