UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ky0nFr2yZtc65RnmbDtcLdygS33w9HjIejz1NZtb2xQ='
WHERE
key_id = 'e418e75e689c7a78b1577654ad557ec4cc4a11f97fe7f4aedd3621d269b2fe43'
AND (
token = 'ky0nFr2yZtc65RnmbDtcLdygS33w9HjIejz1NZtb2xQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)