UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iaA+Jj14UuSCjr90uARXLPTdNfl/7bVk/fZnG6kNoGs='
WHERE
key_id = 'e6d0393e1f229ad9c372d1512020e4b9f9afacd212fae5ae037b0ab955515950'
AND (
token = 'iaA+Jj14UuSCjr90uARXLPTdNfl/7bVk/fZnG6kNoGs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)