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