UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'f4eOtWd8PuyTNXhPzryIjKo4m2jGrDqeIGHUpM1Konw='
WHERE
key_id = '1aae13fef22319633b8c79ad76c902fc73b7e137bd4f58cbdbf8ab4c5326e7f9'
AND (
token = 'f4eOtWd8PuyTNXhPzryIjKo4m2jGrDqeIGHUpM1Konw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)