UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qO+AUgptKS8qVy5iHS0Xf2yMIvrNyd+DK90SgJnwlUM='
WHERE
key_id = '0da90e7237c74c26ee3f8861fb14ea0496526e30fb336c142547fd20b573bee6'
AND (
token = 'qO+AUgptKS8qVy5iHS0Xf2yMIvrNyd+DK90SgJnwlUM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)