UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bQem9P2PVp+K+98ps+4BRpnnTZUFDPJN29cw+5bFZkE=' 
WHERE 
  key_id = '5cce48fac419a3c448c4f12007b534bdf1692313a3a178060a893d8f4f6f9778' 
  AND (
    token = 'bQem9P2PVp+K+98ps+4BRpnnTZUFDPJN29cw+5bFZkE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018