UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MmTTz1CTrgq9koRiSLg3gIth/WnTFY1td/Or2c0TkSw=' 
WHERE 
  key_id = '9299dd3ff55c3dd96f1e6b64c20da55fa16469487406aca1af46264ebc531b6e' 
  AND (
    token = 'MmTTz1CTrgq9koRiSLg3gIth/WnTFY1td/Or2c0TkSw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040