UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6CbOZcZ8f2QwQGNU288qEdgs0fUDvbPlDulq8rya1CI=' 
WHERE 
  key_id = 'f1bc8c1952fbdd4b933c9187d1cab4e8f8421d5f2c916390b3ed663777680550' 
  AND (
    token = '6CbOZcZ8f2QwQGNU288qEdgs0fUDvbPlDulq8rya1CI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027