UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'h9xkLAg0ZPK7Gk6ylrTPkTnKklDLPRAnZQRK0Ly+uK8=' 
WHERE 
  key_id = '1f6004f010cc625f149cf57f3df8da3e08ce45a90829b71df098bd12e2a29983' 
  AND (
    token = 'h9xkLAg0ZPK7Gk6ylrTPkTnKklDLPRAnZQRK0Ly+uK8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028