UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oSmxa7xd3iBfwIZfWFrHTuytd4b+5oxTU32BaG7/fag='
WHERE
key_id = 'ec6340d5f4468ebadb9f7020cdf7487a467bb4692a2407dc8f9d74e2121358e6'
AND (
token = 'oSmxa7xd3iBfwIZfWFrHTuytd4b+5oxTU32BaG7/fag='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)