UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sy5tCjFogHAOemAp3Rn7TGBuPZvcOVYh8xnwLsSSu7I='
WHERE
key_id = 'a283fa355f5fe3df9939013dccfe6c4bf8ae5381cb4e21d777ca7827aa40c3fe'
AND (
token = 'sy5tCjFogHAOemAp3Rn7TGBuPZvcOVYh8xnwLsSSu7I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)