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