UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'VI3jlA2YD88q98k2iXNLCywIDzaadMnmuHiT5HzuMwI='
WHERE
key_id = '57cdcb24e0fe5ab6a69662d2719e957551e246646d2242a4b0b0f3cfef421ef4'
AND (
token = 'VI3jlA2YD88q98k2iXNLCywIDzaadMnmuHiT5HzuMwI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)