UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CSCHuG42wrqh9nuEkEn8vWaDwnqXLqAwJ6F4PcXdCGg=' 
WHERE 
  key_id = '32931ad666479a92a097fb21606b513ba26f7528a3b9a2c28dec9e6e1dd3711c' 
  AND (
    token = 'CSCHuG42wrqh9nuEkEn8vWaDwnqXLqAwJ6F4PcXdCGg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026