UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Tu06u1vgrBcQ1h3nfVn6LGH5AnmpVFV4IRFF2vDzXTs=' 
WHERE 
  key_id = 'b45ff5eab8c5896a399464f60cab7b164dc8030f51edee205cab23b78b50da53' 
  AND (
    token = 'Tu06u1vgrBcQ1h3nfVn6LGH5AnmpVFV4IRFF2vDzXTs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019