UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '96YxWTviE6iRQSqnVJYAuy7Hrq+te+XQAGJVs2XWalQ='
WHERE
key_id = '10589f6110ffec6c978774e5ed02b4d111e0b61202a25158ada05cdd1c9dc73a'
AND (
token = '96YxWTviE6iRQSqnVJYAuy7Hrq+te+XQAGJVs2XWalQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)