UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EtuS28qqwP5xvs99fX4OarV0lye3kMyScmRFpsxigAI=' 
WHERE 
  key_id = '12cfe8980fde03f2ce00c0973b78b60b3dc22f5caf880bc0886bfcf4b8551e03' 
  AND (
    token = 'EtuS28qqwP5xvs99fX4OarV0lye3kMyScmRFpsxigAI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022