UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9keWa+TUn0nlD4BWdnifg1RApajEH2iZkqwxsN3Y7AQ='
WHERE
key_id = 'e2d6ab6ac4fc08b6e8bea943134d3305edbdea765d3999d6726d7df4921f3788'
AND (
token = '9keWa+TUn0nlD4BWdnifg1RApajEH2iZkqwxsN3Y7AQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)