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