UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JVIYMqu0S36xboWSiGfW4OfPx8WAle7hSEdLU07UWEU='
WHERE
key_id = '41f66312cb36a55c621742c5c30894ee17494477bd88cd3c2818c902e23a587e'
AND (
token = 'JVIYMqu0S36xboWSiGfW4OfPx8WAle7hSEdLU07UWEU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)