UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gIReZ1GA560djxb4TPj+PWbUoD/8hZLepCl7hrBM71M=' 
WHERE 
  key_id = 'e848a85a45d8aaff2a22de0b6f0a4c1660ccf7eb14bda242d034177d143d909e' 
  AND (
    token = 'gIReZ1GA560djxb4TPj+PWbUoD/8hZLepCl7hrBM71M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035