UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '22f0QBqdofML8TAOJ4ZUk0lcoF3EBT0kVfEEYllxpgI='
WHERE
key_id = '50281b3e8ee8a9fcc55f9e0bc4b068afad239bb111fdcf658362b67234727f6d'
AND (
token = '22f0QBqdofML8TAOJ4ZUk0lcoF3EBT0kVfEEYllxpgI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)