UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'M79jkU/3tgDKmVyFALH3IS8+/FCgxxBTCIymgER1M80='
WHERE
key_id = 'a487c82442fc2fda4334230237b2e931c6960a9121ad9352cb5278f47a88ac4e'
AND (
token = 'M79jkU/3tgDKmVyFALH3IS8+/FCgxxBTCIymgER1M80='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)