UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Hb+Sk0RKMoLhAV0wkvFz9DTVF94md9dBzK4WFmb/Ctw=' 
WHERE 
  key_id = '69fe1086cbc48c31c566c143777f56ad7999bbc7f7201cd2d2680c371f0f84c7' 
  AND (
    token = 'Hb+Sk0RKMoLhAV0wkvFz9DTVF94md9dBzK4WFmb/Ctw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023