UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ycqHIzLQkxqC7i+R9DR5YqE+saBktmabRpJLKruz60I=' 
WHERE 
  key_id = '8b500dbac047e86d52ec539bea3be6dd43d2ae1cb6e443e12a29625d5c402302' 
  AND (
    token = 'ycqHIzLQkxqC7i+R9DR5YqE+saBktmabRpJLKruz60I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039