UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ihHGoAg4lqepDx2gf8aupFHWWr9j+aqaxkcTOJpu0Os=' 
WHERE 
  key_id = 'f382f1358e7615fd8959cac16deb9b57d6f4a0b15c14b648ca7c9bb6b673a753' 
  AND (
    token = 'ihHGoAg4lqepDx2gf8aupFHWWr9j+aqaxkcTOJpu0Os=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036