UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'p3Hao047GLnLHNH6pmMPYdF9h8uPA5/8Zzzgq9RZgBc=' 
WHERE 
  key_id = 'c85025ddc7a8ab32ddbc58679c30acb50a21e49cb02974b7d63ea4f6cdabca9e' 
  AND (
    token = 'p3Hao047GLnLHNH6pmMPYdF9h8uPA5/8Zzzgq9RZgBc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041