UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9SSsdP49smnrPiu0d3BPuJ/5+l9PNOUnYn3F0x3ajr0='
WHERE
key_id = 'f2e1b2e73fcd8423b02618f7f720653fcc8e4e34b7074acd61c7bbe43bd6beec'
AND (
token = '9SSsdP49smnrPiu0d3BPuJ/5+l9PNOUnYn3F0x3ajr0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)