UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZmGfKiONdE7D2x6AgfT6rwUsFV4VUrqdJponp5+eOOA=' 
WHERE 
  key_id = 'f78063a49a7ca316ea90e25d5e9b3ea2cb6dbe836dfd4077aca6a28aeb8ed9b1' 
  AND (
    token = 'ZmGfKiONdE7D2x6AgfT6rwUsFV4VUrqdJponp5+eOOA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044