UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cwcqBofgQnRTdmrDsjdg785YhpKp1hpZpcZGlmEURXA=' 
WHERE 
  key_id = '0d6b5cd2893741dab50e2b2b4a5a4edb4ce3ba7ea40f9cf96c328634525a341b' 
  AND (
    token = 'cwcqBofgQnRTdmrDsjdg785YhpKp1hpZpcZGlmEURXA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040