UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CnfG7FerOKKzxN3Rg3opKB/TK3/rGKuGlkenrZRdIlc='
WHERE
key_id = '0ebaa7acb5e21356370b4c4c7e160fe1f2d1cb972e768190038950d1c01add1a'
AND (
token = 'CnfG7FerOKKzxN3Rg3opKB/TK3/rGKuGlkenrZRdIlc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)